package com.itheima.Task01;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class List {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<Integer> list = new ArrayList<>();
        Class aClass = list.getClass();
        Method add = aClass.getMethod("add", Object.class);
        add.invoke(list, "张三");
        System.out.println(list);


    }
}
